﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignPatternsDemo
{
    public class Singleton
    {
        private static Singleton _sInstance = new Singleton();

        // private  constructor stops non-local instantiation
        private Singleton()
        {
            // nothing needs to be done for this example
            Console.WriteLine("Singleton()");
        }

        public static Singleton GetInstance()
        {
            Console.WriteLine("Getting an instance of singleton class");
            return _sInstance;
        }
    }
}
